// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate gtype;
extern crate lazy_static;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// Request message for CreateDataAccessLabel.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateDataAccessLabelRequest {
    /// Required. The parent resource where this Data Access Label will be created.
    /// Format: `projects/{project}/locations/{location}/instances/{instance}`
    pub parent: std::string::String,

    /// Required. Data access label to create.
    pub data_access_label: std::option::Option<crate::model::DataAccessLabel>,

    /// Required. The ID to use for the data access label, which will become the
    /// label's display name and the final component of the label's resource name.
    /// The maximum number of characters should be 63. Regex pattern is as per AIP:
    /// <https://google.aip.dev/122#resource-id-segments>
    pub data_access_label_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateDataAccessLabelRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateDataAccessLabelRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [data_access_label][crate::model::CreateDataAccessLabelRequest::data_access_label].
    pub fn set_data_access_label<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DataAccessLabel>,
    {
        self.data_access_label = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [data_access_label][crate::model::CreateDataAccessLabelRequest::data_access_label].
    pub fn set_or_clear_data_access_label<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DataAccessLabel>,
    {
        self.data_access_label = v.map(|x| x.into());
        self
    }

    /// Sets the value of [data_access_label_id][crate::model::CreateDataAccessLabelRequest::data_access_label_id].
    pub fn set_data_access_label_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.data_access_label_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateDataAccessLabelRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.CreateDataAccessLabelRequest"
    }
}

/// Request message to retrieve a data access label.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetDataAccessLabelRequest {
    /// Required. The ID of the data access label to retrieve.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessLabels/{data_access_label}`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetDataAccessLabelRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetDataAccessLabelRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetDataAccessLabelRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.GetDataAccessLabelRequest"
    }
}

/// Request message for ListDataAccessLabels.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListDataAccessLabelsRequest {
    /// Required. The parent resource where this data access label will be created.
    /// Format: `projects/{project}/locations/{location}/instances/{instance}`
    pub parent: std::string::String,

    /// The maximum number of data access labels to return. The service may return
    /// fewer than this value. If unspecified, at most 100 data access labels will
    /// be returned. The maximum value is 1000; values above 1000 will be coerced
    /// to 1000.
    pub page_size: i32,

    /// A page token, received from a previous `ListDataAccessLabelsRequest` call.
    /// Provide this to retrieve the subsequent page.
    pub page_token: std::string::String,

    /// Optional. A filter which should follow the guidelines of AIP-160.
    /// Supports filtering on all fieds of DataAccessLabel and all operations as
    /// mentioned in <https://google.aip.dev/160>.
    /// example filter: "create_time greater than \"2023-04-21T11:30:00-04:00\" OR
    /// display_name:\"-21-1\"".
    pub filter: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListDataAccessLabelsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListDataAccessLabelsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListDataAccessLabelsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListDataAccessLabelsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListDataAccessLabelsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }
}

impl wkt::message::Message for ListDataAccessLabelsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListDataAccessLabelsRequest"
    }
}

/// Response message for ListDataAccessLabels.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListDataAccessLabelsResponse {
    /// List of data access labels.
    pub data_access_labels: std::vec::Vec<crate::model::DataAccessLabel>,

    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListDataAccessLabelsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [data_access_labels][crate::model::ListDataAccessLabelsResponse::data_access_labels].
    pub fn set_data_access_labels<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::DataAccessLabel>,
    {
        use std::iter::Iterator;
        self.data_access_labels = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListDataAccessLabelsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListDataAccessLabelsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListDataAccessLabelsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListDataAccessLabelsResponse {
    type PageItem = crate::model::DataAccessLabel;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.data_access_labels
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for UpdateDataAccessLabel method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateDataAccessLabelRequest {
    /// Required. The data access label to update.
    ///
    /// The label's `name` field is used to identify the label to update.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessLabels/{data_access_label}`
    pub data_access_label: std::option::Option<crate::model::DataAccessLabel>,

    /// The list of fields to update. If not included, all fields with a non-empty
    /// value will be overwritten. Currently, only the description and definition
    /// fields are supported for update; an update call that attempts to update any
    /// other fields will return INVALID_ARGUMENT.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateDataAccessLabelRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [data_access_label][crate::model::UpdateDataAccessLabelRequest::data_access_label].
    pub fn set_data_access_label<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DataAccessLabel>,
    {
        self.data_access_label = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [data_access_label][crate::model::UpdateDataAccessLabelRequest::data_access_label].
    pub fn set_or_clear_data_access_label<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DataAccessLabel>,
    {
        self.data_access_label = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateDataAccessLabelRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateDataAccessLabelRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateDataAccessLabelRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.UpdateDataAccessLabelRequest"
    }
}

/// Request message to delete a data access label.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteDataAccessLabelRequest {
    /// Required. The ID of the data access label to delete.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessLabels/{data_access_label}`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteDataAccessLabelRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteDataAccessLabelRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteDataAccessLabelRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.DeleteDataAccessLabelRequest"
    }
}

/// Request message for CreateDataAccessScope.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateDataAccessScopeRequest {
    /// Required. The parent resource where this Data Access Scope will be created.
    /// Format: `projects/{project}/locations/{location}/instances/{instance}`
    pub parent: std::string::String,

    /// Required. Data access scope to create.
    pub data_access_scope: std::option::Option<crate::model::DataAccessScope>,

    /// Required. The user provided scope id which will become the last part of the
    /// name of the scope resource. Needs to be compliant with
    /// <https://google.aip.dev/122>
    pub data_access_scope_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateDataAccessScopeRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateDataAccessScopeRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [data_access_scope][crate::model::CreateDataAccessScopeRequest::data_access_scope].
    pub fn set_data_access_scope<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DataAccessScope>,
    {
        self.data_access_scope = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [data_access_scope][crate::model::CreateDataAccessScopeRequest::data_access_scope].
    pub fn set_or_clear_data_access_scope<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DataAccessScope>,
    {
        self.data_access_scope = v.map(|x| x.into());
        self
    }

    /// Sets the value of [data_access_scope_id][crate::model::CreateDataAccessScopeRequest::data_access_scope_id].
    pub fn set_data_access_scope_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.data_access_scope_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateDataAccessScopeRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.CreateDataAccessScopeRequest"
    }
}

/// Request message to retrieve a data access scope.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetDataAccessScopeRequest {
    /// Required. The ID of the data access scope to retrieve.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{data_access_scope}`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetDataAccessScopeRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetDataAccessScopeRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetDataAccessScopeRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.GetDataAccessScopeRequest"
    }
}

/// Request message for ListDataAccessScopes.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListDataAccessScopesRequest {
    /// Required. The parent resource where this data access scope will be created.
    /// Format: `projects/{project}/locations/{location}/instances/{instance}`
    pub parent: std::string::String,

    /// The maximum number of data access scopes to return. The service may return
    /// fewer than this value. If unspecified, at most 100 data access scopes will
    /// be returned. The maximum value is 1000; values above 1000 will be coerced
    /// to 1000.
    pub page_size: i32,

    /// A page token, received from a previous `ListDataAccessScopesRequest` call.
    /// Provide this to retrieve the subsequent page.
    pub page_token: std::string::String,

    /// Optional. A filter which should follow the guidelines of AIP-160.
    /// Supports filtering on all fieds of DataAccessScope and all operations as
    /// mentioned in <https://google.aip.dev/160>.
    /// example filter: "create_time greater than \"2023-04-21T11:30:00-04:00\" OR
    /// display_name:\"-21-1\"".
    pub filter: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListDataAccessScopesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListDataAccessScopesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListDataAccessScopesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListDataAccessScopesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListDataAccessScopesRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }
}

impl wkt::message::Message for ListDataAccessScopesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListDataAccessScopesRequest"
    }
}

/// Response message for ListDataAccessScopes.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListDataAccessScopesResponse {
    /// List of data access scopes.
    pub data_access_scopes: std::vec::Vec<crate::model::DataAccessScope>,

    /// Whether or not global scope is granted to the user.
    pub global_data_access_scope_granted: std::option::Option<bool>,

    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListDataAccessScopesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [data_access_scopes][crate::model::ListDataAccessScopesResponse::data_access_scopes].
    pub fn set_data_access_scopes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::DataAccessScope>,
    {
        use std::iter::Iterator;
        self.data_access_scopes = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [global_data_access_scope_granted][crate::model::ListDataAccessScopesResponse::global_data_access_scope_granted].
    pub fn set_global_data_access_scope_granted<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<bool>,
    {
        self.global_data_access_scope_granted = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [global_data_access_scope_granted][crate::model::ListDataAccessScopesResponse::global_data_access_scope_granted].
    pub fn set_or_clear_global_data_access_scope_granted<T>(
        mut self,
        v: std::option::Option<T>,
    ) -> Self
    where
        T: std::convert::Into<bool>,
    {
        self.global_data_access_scope_granted = v.map(|x| x.into());
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListDataAccessScopesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListDataAccessScopesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListDataAccessScopesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListDataAccessScopesResponse {
    type PageItem = crate::model::DataAccessScope;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.data_access_scopes
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for UpdateDataAccessScope method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateDataAccessScopeRequest {
    /// Required. The data access scope to update.
    ///
    /// The scope's `name` field is used to identify the scope to update.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{data_access_scope}`
    pub data_access_scope: std::option::Option<crate::model::DataAccessScope>,

    /// The list of fields to update. If not included, all fields with a non-empty
    /// value will be overwritten. Currently, only the description, the allowed
    /// and denied labels list fields are supported for update;
    /// an update call that attempts to update any
    /// other fields will return INVALID_ARGUMENT.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateDataAccessScopeRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [data_access_scope][crate::model::UpdateDataAccessScopeRequest::data_access_scope].
    pub fn set_data_access_scope<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DataAccessScope>,
    {
        self.data_access_scope = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [data_access_scope][crate::model::UpdateDataAccessScopeRequest::data_access_scope].
    pub fn set_or_clear_data_access_scope<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DataAccessScope>,
    {
        self.data_access_scope = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateDataAccessScopeRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateDataAccessScopeRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateDataAccessScopeRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.UpdateDataAccessScopeRequest"
    }
}

/// Request message to delete a data access scope.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteDataAccessScopeRequest {
    /// Required. The ID of the data access scope to delete.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{data_access_scope}`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteDataAccessScopeRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteDataAccessScopeRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteDataAccessScopeRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.DeleteDataAccessScopeRequest"
    }
}

/// A DataAccessLabel is a label on events to define user access to data.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DataAccessLabel {
    /// The unique resource name of the data access label.
    pub name: std::string::String,

    /// Output only. The short name displayed for the label as it appears on event
    /// data.
    pub display_name: std::string::String,

    /// Output only. The time at which the data access label was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time at which the data access label was last updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The user who created the data access label.
    pub author: std::string::String,

    /// Output only. The user who last updated the data access label.
    pub last_editor: std::string::String,

    /// Optional. A description of the data access label for a human reader.
    pub description: std::string::String,

    /// Required.
    /// The definition of the data access label that determines which
    /// data gets tagged with this label.
    pub definition: std::option::Option<crate::model::data_access_label::Definition>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DataAccessLabel {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DataAccessLabel::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::DataAccessLabel::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::DataAccessLabel::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::DataAccessLabel::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::DataAccessLabel::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::DataAccessLabel::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [author][crate::model::DataAccessLabel::author].
    pub fn set_author<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.author = v.into();
        self
    }

    /// Sets the value of [last_editor][crate::model::DataAccessLabel::last_editor].
    pub fn set_last_editor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.last_editor = v.into();
        self
    }

    /// Sets the value of [description][crate::model::DataAccessLabel::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [definition][crate::model::DataAccessLabel::definition].
    ///
    /// Note that all the setters affecting `definition` are mutually
    /// exclusive.
    pub fn set_definition<
        T: std::convert::Into<std::option::Option<crate::model::data_access_label::Definition>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.definition = v.into();
        self
    }

    /// The value of [definition][crate::model::DataAccessLabel::definition]
    /// if it holds a `UdmQuery`, `None` if the field is not set or
    /// holds a different branch.
    pub fn udm_query(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.definition.as_ref().and_then(|v| match v {
            crate::model::data_access_label::Definition::UdmQuery(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [definition][crate::model::DataAccessLabel::definition]
    /// to hold a `UdmQuery`.
    ///
    /// Note that all the setters affecting `definition` are
    /// mutually exclusive.
    pub fn set_udm_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.definition = std::option::Option::Some(
            crate::model::data_access_label::Definition::UdmQuery(v.into()),
        );
        self
    }
}

impl wkt::message::Message for DataAccessLabel {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.DataAccessLabel"
    }
}

/// Defines additional types related to [DataAccessLabel].
pub mod data_access_label {
    #[allow(unused_imports)]
    use super::*;

    /// Required.
    /// The definition of the data access label that determines which
    /// data gets tagged with this label.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Definition {
        /// A UDM query over event data.
        UdmQuery(std::string::String),
    }
}

/// A DataAccessScope is a boolean expression of data access labels used
/// to restrict access to data for users.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DataAccessScope {
    /// Required. The unique full name of the data access scope.
    /// The name should comply with <https://google.aip.dev/122> standards.
    pub name: std::string::String,

    /// Optional. The allowed labels for the scope.
    /// Either allow_all or allowed_data_access_labels needs to be provided.
    /// When provided, there has to be at least one label allowed for the scope to
    /// be valid.
    /// The logical operator for evaluation of the allowed labels is OR.
    /// E.g.: A customer with scope with allowed labels A and B will be able
    /// to see data with labeled with A or B or (A and B).
    pub allowed_data_access_labels: std::vec::Vec<crate::model::DataAccessLabelReference>,

    /// Optional. The denied labels for the scope.
    /// The logical operator for evaluation of the denied labels is AND.
    /// E.g.: A customer with scope with denied labels A and B won't be able
    /// to see data labeled with A and data labeled with B
    /// and data with labels A and B.
    pub denied_data_access_labels: std::vec::Vec<crate::model::DataAccessLabelReference>,

    /// Output only. The name to be used for display to customers of the data
    /// access scope.
    pub display_name: std::string::String,

    /// Output only. The time at which the data access scope was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time at which the data access scope was last updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The user who created the data access scope.
    pub author: std::string::String,

    /// Output only. The user who last updated the data access scope.
    pub last_editor: std::string::String,

    /// Optional. A description of the data access scope for a human reader.
    pub description: std::string::String,

    /// Optional. Whether or not the scope allows all labels, allow_all and
    /// allowed_data_access_labels are mutually exclusive and one of them must be
    /// present. denied_data_access_labels can still be used along with allow_all.
    /// When combined with denied_data_access_labels, access will be granted to all
    /// data that doesn't have labels mentioned in denied_data_access_labels. E.g.:
    /// A customer with scope with denied labels A and B and allow_all will be able
    /// to see all data except data labeled with A and data labeled with B and data
    /// with labels A and B.
    pub allow_all: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DataAccessScope {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DataAccessScope::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [allowed_data_access_labels][crate::model::DataAccessScope::allowed_data_access_labels].
    pub fn set_allowed_data_access_labels<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::DataAccessLabelReference>,
    {
        use std::iter::Iterator;
        self.allowed_data_access_labels = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [denied_data_access_labels][crate::model::DataAccessScope::denied_data_access_labels].
    pub fn set_denied_data_access_labels<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::DataAccessLabelReference>,
    {
        use std::iter::Iterator;
        self.denied_data_access_labels = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [display_name][crate::model::DataAccessScope::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::DataAccessScope::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::DataAccessScope::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::DataAccessScope::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::DataAccessScope::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [author][crate::model::DataAccessScope::author].
    pub fn set_author<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.author = v.into();
        self
    }

    /// Sets the value of [last_editor][crate::model::DataAccessScope::last_editor].
    pub fn set_last_editor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.last_editor = v.into();
        self
    }

    /// Sets the value of [description][crate::model::DataAccessScope::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [allow_all][crate::model::DataAccessScope::allow_all].
    pub fn set_allow_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.allow_all = v.into();
        self
    }
}

impl wkt::message::Message for DataAccessScope {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.DataAccessScope"
    }
}

/// Reference object to a data access label.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DataAccessLabelReference {
    /// Output only. The display name of the label.
    /// Data access label and log types's name
    /// will match the display name of the resource.
    /// The asset namespace will match the namespace itself.
    /// The ingestion key value pair will match the key of the tuple.
    pub display_name: std::string::String,

    /// The unique identifier for the label.
    pub label: std::option::Option<crate::model::data_access_label_reference::Label>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DataAccessLabelReference {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [display_name][crate::model::DataAccessLabelReference::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [label][crate::model::DataAccessLabelReference::label].
    ///
    /// Note that all the setters affecting `label` are mutually
    /// exclusive.
    pub fn set_label<
        T: std::convert::Into<std::option::Option<crate::model::data_access_label_reference::Label>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.label = v.into();
        self
    }

    /// The value of [label][crate::model::DataAccessLabelReference::label]
    /// if it holds a `DataAccessLabel`, `None` if the field is not set or
    /// holds a different branch.
    pub fn data_access_label(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.label.as_ref().and_then(|v| match v {
            crate::model::data_access_label_reference::Label::DataAccessLabel(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [label][crate::model::DataAccessLabelReference::label]
    /// to hold a `DataAccessLabel`.
    ///
    /// Note that all the setters affecting `label` are
    /// mutually exclusive.
    pub fn set_data_access_label<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.label = std::option::Option::Some(
            crate::model::data_access_label_reference::Label::DataAccessLabel(v.into()),
        );
        self
    }

    /// The value of [label][crate::model::DataAccessLabelReference::label]
    /// if it holds a `LogType`, `None` if the field is not set or
    /// holds a different branch.
    pub fn log_type(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.label.as_ref().and_then(|v| match v {
            crate::model::data_access_label_reference::Label::LogType(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [label][crate::model::DataAccessLabelReference::label]
    /// to hold a `LogType`.
    ///
    /// Note that all the setters affecting `label` are
    /// mutually exclusive.
    pub fn set_log_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.label = std::option::Option::Some(
            crate::model::data_access_label_reference::Label::LogType(v.into()),
        );
        self
    }

    /// The value of [label][crate::model::DataAccessLabelReference::label]
    /// if it holds a `AssetNamespace`, `None` if the field is not set or
    /// holds a different branch.
    pub fn asset_namespace(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.label.as_ref().and_then(|v| match v {
            crate::model::data_access_label_reference::Label::AssetNamespace(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [label][crate::model::DataAccessLabelReference::label]
    /// to hold a `AssetNamespace`.
    ///
    /// Note that all the setters affecting `label` are
    /// mutually exclusive.
    pub fn set_asset_namespace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.label = std::option::Option::Some(
            crate::model::data_access_label_reference::Label::AssetNamespace(v.into()),
        );
        self
    }

    /// The value of [label][crate::model::DataAccessLabelReference::label]
    /// if it holds a `IngestionLabel`, `None` if the field is not set or
    /// holds a different branch.
    pub fn ingestion_label(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::IngestionLabel>> {
        #[allow(unreachable_patterns)]
        self.label.as_ref().and_then(|v| match v {
            crate::model::data_access_label_reference::Label::IngestionLabel(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [label][crate::model::DataAccessLabelReference::label]
    /// to hold a `IngestionLabel`.
    ///
    /// Note that all the setters affecting `label` are
    /// mutually exclusive.
    pub fn set_ingestion_label<
        T: std::convert::Into<std::boxed::Box<crate::model::IngestionLabel>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.label = std::option::Option::Some(
            crate::model::data_access_label_reference::Label::IngestionLabel(v.into()),
        );
        self
    }
}

impl wkt::message::Message for DataAccessLabelReference {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.DataAccessLabelReference"
    }
}

/// Defines additional types related to [DataAccessLabelReference].
pub mod data_access_label_reference {
    #[allow(unused_imports)]
    use super::*;

    /// The unique identifier for the label.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Label {
        /// The name of the data access label.
        DataAccessLabel(std::string::String),
        /// The name of the log type.
        LogType(std::string::String),
        /// The asset namespace configured in the forwarder
        /// of the customer's events.
        AssetNamespace(std::string::String),
        /// The ingestion label configured in the forwarder of the customer's events.
        IngestionLabel(std::boxed::Box<crate::model::IngestionLabel>),
    }
}

/// Representation of an ingestion label type.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IngestionLabel {
    /// Required. The key of the ingestion label. Always required.
    pub ingestion_label_key: std::string::String,

    /// Optional. The value of the ingestion label. Optional. An object
    /// with no provided value and some key provided would match
    /// against the given key and ANY value.
    pub ingestion_label_value: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl IngestionLabel {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [ingestion_label_key][crate::model::IngestionLabel::ingestion_label_key].
    pub fn set_ingestion_label_key<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.ingestion_label_key = v.into();
        self
    }

    /// Sets the value of [ingestion_label_value][crate::model::IngestionLabel::ingestion_label_value].
    pub fn set_ingestion_label_value<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.ingestion_label_value = v.into();
        self
    }
}

impl wkt::message::Message for IngestionLabel {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.IngestionLabel"
    }
}

/// A watchlist is a list of entities that allows for bulk operations over the
/// included entities.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Watchlist {
    /// Identifier. Resource name of the watchlist.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/watchlists/{watchlist}`
    pub name: std::string::String,

    /// Required. Display name of the watchlist.
    /// Note that it must be at least one character and less than 63 characters
    /// (<https://google.aip.dev/148>).
    pub display_name: std::string::String,

    /// Optional. Description of the watchlist.
    pub description: std::string::String,

    /// Optional. Weight applied to the risk score for entities
    /// in this watchlist.
    /// The default is 1.0 if it is not specified.
    pub multiplying_factor: f32,

    /// Required. Mechanism to populate entities in the watchlist.
    pub entity_population_mechanism:
        std::option::Option<crate::model::watchlist::EntityPopulationMechanism>,

    /// Output only. Entity count in the watchlist.
    pub entity_count: std::option::Option<crate::model::watchlist::EntityCount>,

    /// Output only. Time the watchlist was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Time the watchlist was last updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. User preferences for watchlist configuration.
    pub watchlist_user_preferences: std::option::Option<crate::model::WatchlistUserPreferences>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Watchlist {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Watchlist::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::Watchlist::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::Watchlist::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [multiplying_factor][crate::model::Watchlist::multiplying_factor].
    pub fn set_multiplying_factor<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
        self.multiplying_factor = v.into();
        self
    }

    /// Sets the value of [entity_population_mechanism][crate::model::Watchlist::entity_population_mechanism].
    pub fn set_entity_population_mechanism<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::watchlist::EntityPopulationMechanism>,
    {
        self.entity_population_mechanism = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [entity_population_mechanism][crate::model::Watchlist::entity_population_mechanism].
    pub fn set_or_clear_entity_population_mechanism<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::watchlist::EntityPopulationMechanism>,
    {
        self.entity_population_mechanism = v.map(|x| x.into());
        self
    }

    /// Sets the value of [entity_count][crate::model::Watchlist::entity_count].
    pub fn set_entity_count<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::watchlist::EntityCount>,
    {
        self.entity_count = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [entity_count][crate::model::Watchlist::entity_count].
    pub fn set_or_clear_entity_count<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::watchlist::EntityCount>,
    {
        self.entity_count = v.map(|x| x.into());
        self
    }

    /// Sets the value of [create_time][crate::model::Watchlist::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Watchlist::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Watchlist::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Watchlist::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [watchlist_user_preferences][crate::model::Watchlist::watchlist_user_preferences].
    pub fn set_watchlist_user_preferences<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::WatchlistUserPreferences>,
    {
        self.watchlist_user_preferences = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [watchlist_user_preferences][crate::model::Watchlist::watchlist_user_preferences].
    pub fn set_or_clear_watchlist_user_preferences<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::WatchlistUserPreferences>,
    {
        self.watchlist_user_preferences = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for Watchlist {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.Watchlist"
    }
}

/// Defines additional types related to [Watchlist].
pub mod watchlist {
    #[allow(unused_imports)]
    use super::*;

    /// Mechanism to populate entities in the watchlist.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct EntityPopulationMechanism {
        /// Ways to populate entities in watchlist.
        /// Currently, only manual is supported.
        pub mechanism:
            std::option::Option<crate::model::watchlist::entity_population_mechanism::Mechanism>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl EntityPopulationMechanism {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [mechanism][crate::model::watchlist::EntityPopulationMechanism::mechanism].
        ///
        /// Note that all the setters affecting `mechanism` are mutually
        /// exclusive.
        pub fn set_mechanism<
            T: std::convert::Into<
                    std::option::Option<
                        crate::model::watchlist::entity_population_mechanism::Mechanism,
                    >,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.mechanism = v.into();
            self
        }

        /// The value of [mechanism][crate::model::watchlist::EntityPopulationMechanism::mechanism]
        /// if it holds a `Manual`, `None` if the field is not set or
        /// holds a different branch.
        pub fn manual(
            &self,
        ) -> std::option::Option<
            &std::boxed::Box<crate::model::watchlist::entity_population_mechanism::Manual>,
        > {
            #[allow(unreachable_patterns)]
            self.mechanism.as_ref().and_then(|v| match v {
                crate::model::watchlist::entity_population_mechanism::Mechanism::Manual(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [mechanism][crate::model::watchlist::EntityPopulationMechanism::mechanism]
        /// to hold a `Manual`.
        ///
        /// Note that all the setters affecting `mechanism` are
        /// mutually exclusive.
        pub fn set_manual<
            T: std::convert::Into<
                    std::boxed::Box<crate::model::watchlist::entity_population_mechanism::Manual>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.mechanism = std::option::Option::Some(
                crate::model::watchlist::entity_population_mechanism::Mechanism::Manual(v.into()),
            );
            self
        }
    }

    impl wkt::message::Message for EntityPopulationMechanism {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.chronicle.v1.Watchlist.EntityPopulationMechanism"
        }
    }

    /// Defines additional types related to [EntityPopulationMechanism].
    pub mod entity_population_mechanism {
        #[allow(unused_imports)]
        use super::*;

        /// Entities are added manually.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Manual {
            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Manual {
            pub fn new() -> Self {
                std::default::Default::default()
            }
        }

        impl wkt::message::Message for Manual {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.chronicle.v1.Watchlist.EntityPopulationMechanism.Manual"
            }
        }

        /// Ways to populate entities in watchlist.
        /// Currently, only manual is supported.
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum Mechanism {
            /// Optional. Entities are added manually.
            Manual(std::boxed::Box<crate::model::watchlist::entity_population_mechanism::Manual>),
        }
    }

    /// Count of different types of entities in the watchlist.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct EntityCount {
        /// Output only. Count of user type entities in the watchlist.
        pub user: i32,

        /// Output only. Count of asset type entities in the watchlist.
        pub asset: i32,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl EntityCount {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [user][crate::model::watchlist::EntityCount::user].
        pub fn set_user<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.user = v.into();
            self
        }

        /// Sets the value of [asset][crate::model::watchlist::EntityCount::asset].
        pub fn set_asset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.asset = v.into();
            self
        }
    }

    impl wkt::message::Message for EntityCount {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.chronicle.v1.Watchlist.EntityCount"
        }
    }
}

/// A collection of user preferences for watchlist UI configuration.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct WatchlistUserPreferences {
    /// Optional. Whether the watchlist is pinned on the dashboard.
    pub pinned: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl WatchlistUserPreferences {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [pinned][crate::model::WatchlistUserPreferences::pinned].
    pub fn set_pinned<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.pinned = v.into();
        self
    }
}

impl wkt::message::Message for WatchlistUserPreferences {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.WatchlistUserPreferences"
    }
}

/// Request message for getting a watchlist.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetWatchlistRequest {
    /// Required. The parent, which owns this collection of watchlists.
    /// The name of the watchlist to retrieve.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/watchlists/{watchlist}`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetWatchlistRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetWatchlistRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetWatchlistRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.GetWatchlistRequest"
    }
}

/// Request message for listing watchlists.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListWatchlistsRequest {
    /// Required. The parent, which owns this collection of watchlists.
    /// Format: `projects/{project}/locations/{location}/instances/{instance}`
    pub parent: std::string::String,

    /// Optional. The maximum number of watchlists to return.
    /// The service may return fewer than this value.
    /// If unspecified, at most 200 watchlists will be returned.
    /// The maximum value is 200; values above 200 will be coerced to 200.
    pub page_size: i32,

    /// Optional. A page token, received from a previous `ListWatchlists` call.
    /// Provide this to retrieve the subsequent page.
    ///
    /// When paginating, all other parameters provided to
    /// `ListWatchlists` must match the call that provided the page
    /// token.
    pub page_token: std::string::String,

    /// Optional. Which watchlist to return in aip.dev/160 form.
    /// Currently, only the following filters are supported:
    ///
    /// - `watchlist_user_preferences.pinned=true`
    /// - `has_entity([ENTITY_INDICATOR],[ENTITY_TYPE])`
    /// - `has_entity([ENTITY_INDICATOR],[ENTITY_TYPE],[NAMESPACE])`
    pub filter: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListWatchlistsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListWatchlistsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListWatchlistsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListWatchlistsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListWatchlistsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }
}

impl wkt::message::Message for ListWatchlistsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListWatchlistsRequest"
    }
}

/// Response message for listing watchlists.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListWatchlistsResponse {
    /// Optional. The watchlists from the specified instance.
    pub watchlists: std::vec::Vec<crate::model::Watchlist>,

    /// Optional. A token, which can be sent as `page_token` to retrieve the next
    /// page. If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListWatchlistsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [watchlists][crate::model::ListWatchlistsResponse::watchlists].
    pub fn set_watchlists<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Watchlist>,
    {
        use std::iter::Iterator;
        self.watchlists = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListWatchlistsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListWatchlistsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListWatchlistsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListWatchlistsResponse {
    type PageItem = crate::model::Watchlist;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.watchlists
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for creating watchlist.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateWatchlistRequest {
    /// Required. The parent resource where this watchlist will be created.
    /// Format: `projects/{project}/locations/{location}/instances/{instance}`
    pub parent: std::string::String,

    /// Optional. The ID to use for the watchlist,
    /// which will become the final component of the watchlist's resource name.
    ///
    /// This value should be 4-63 characters, and valid characters
    /// are /[a-z][0-9]-/.
    pub watchlist_id: std::string::String,

    /// Required. The watchlist to create.
    pub watchlist: std::option::Option<crate::model::Watchlist>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateWatchlistRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateWatchlistRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [watchlist_id][crate::model::CreateWatchlistRequest::watchlist_id].
    pub fn set_watchlist_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.watchlist_id = v.into();
        self
    }

    /// Sets the value of [watchlist][crate::model::CreateWatchlistRequest::watchlist].
    pub fn set_watchlist<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Watchlist>,
    {
        self.watchlist = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [watchlist][crate::model::CreateWatchlistRequest::watchlist].
    pub fn set_or_clear_watchlist<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Watchlist>,
    {
        self.watchlist = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateWatchlistRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.CreateWatchlistRequest"
    }
}

/// Request message for updating watchlist.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateWatchlistRequest {
    /// Required. The watchlist to update.
    ///
    /// The watchlist's `name` field is used to identify the watchlist to update.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/watchlists/{watchlist}`
    pub watchlist: std::option::Option<crate::model::Watchlist>,

    /// Optional. The list of fields to update.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateWatchlistRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [watchlist][crate::model::UpdateWatchlistRequest::watchlist].
    pub fn set_watchlist<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Watchlist>,
    {
        self.watchlist = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [watchlist][crate::model::UpdateWatchlistRequest::watchlist].
    pub fn set_or_clear_watchlist<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Watchlist>,
    {
        self.watchlist = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateWatchlistRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateWatchlistRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateWatchlistRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.UpdateWatchlistRequest"
    }
}

/// Request message for deleting watchlist.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteWatchlistRequest {
    /// Required. The name of the watchlist to delete.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/watchlists/{watchlist}`
    pub name: std::string::String,

    /// Optional. If set to true, any entities under this watchlist will also be
    /// deleted. (Otherwise, the request will only work if the watchlist has no
    /// entities.)
    pub force: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteWatchlistRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteWatchlistRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [force][crate::model::DeleteWatchlistRequest::force].
    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.force = v.into();
        self
    }
}

impl wkt::message::Message for DeleteWatchlistRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.DeleteWatchlistRequest"
    }
}

/// A Instance represents an instantiation of the Instance product.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Instance {
    /// Identifier. The resource name of this instance.
    /// Format: `projects/{project}/locations/{location}/instances/{instance}`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Instance {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Instance::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for Instance {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.Instance"
    }
}

/// Request to get a Instance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetInstanceRequest {
    /// Required. The name of the instance to retrieve.
    /// Format:
    /// `projects/{project_id}/locations/{location}/instances/{instance}`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetInstanceRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.GetInstanceRequest"
    }
}

/// ScopeInfo specifies the scope info of the reference list.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ScopeInfo {
    /// Required. The list of scope names of the reference list, if the list is
    /// empty the reference list is treated as unscoped.
    pub reference_list_scope: std::option::Option<crate::model::ReferenceListScope>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ScopeInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [reference_list_scope][crate::model::ScopeInfo::reference_list_scope].
    pub fn set_reference_list_scope<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ReferenceListScope>,
    {
        self.reference_list_scope = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [reference_list_scope][crate::model::ScopeInfo::reference_list_scope].
    pub fn set_or_clear_reference_list_scope<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ReferenceListScope>,
    {
        self.reference_list_scope = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for ScopeInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ScopeInfo"
    }
}

/// ReferenceListScope specifies the list of scope names of the reference list.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReferenceListScope {
    /// Optional. The list of scope names of the reference list. The scope names
    /// should be full resource names and should be of the format:
    /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{scope_name}`.
    pub scope_names: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ReferenceListScope {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [scope_names][crate::model::ReferenceListScope::scope_names].
    pub fn set_scope_names<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.scope_names = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ReferenceListScope {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ReferenceListScope"
    }
}

/// A request to get details about a reference list.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetReferenceListRequest {
    /// Required. The resource name of the reference list to retrieve.
    /// Format:
    /// `projects/{project}/locations/{locations}/instances/{instance}/referenceLists/{reference_list}`
    pub name: std::string::String,

    /// How much of the ReferenceList to view. Defaults to
    /// REFERENCE_LIST_VIEW_FULL.
    pub view: crate::model::ReferenceListView,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetReferenceListRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetReferenceListRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [view][crate::model::GetReferenceListRequest::view].
    pub fn set_view<T: std::convert::Into<crate::model::ReferenceListView>>(
        mut self,
        v: T,
    ) -> Self {
        self.view = v.into();
        self
    }
}

impl wkt::message::Message for GetReferenceListRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.GetReferenceListRequest"
    }
}

/// A request for a list of reference lists.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListReferenceListsRequest {
    /// Required. The parent, which owns this collection of reference lists.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}`
    pub parent: std::string::String,

    /// The maximum number of reference lists to return.
    /// The service may return fewer than this value.
    /// If unspecified, at most 100 reference lists will be returned.
    /// The maximum value is 1000; values above 1000 will be coerced to 1000.
    pub page_size: i32,

    /// A page token, received from a previous `ListReferenceLists` call.
    /// Provide this to retrieve the subsequent page.
    /// When paginating, all other parameters provided to `ListReferenceLists` must
    /// match the call that provided the page token.
    pub page_token: std::string::String,

    /// How much of each ReferenceList to view. Defaults to
    /// REFERENCE_LIST_VIEW_BASIC.
    pub view: crate::model::ReferenceListView,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListReferenceListsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListReferenceListsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListReferenceListsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListReferenceListsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [view][crate::model::ListReferenceListsRequest::view].
    pub fn set_view<T: std::convert::Into<crate::model::ReferenceListView>>(
        mut self,
        v: T,
    ) -> Self {
        self.view = v.into();
        self
    }
}

impl wkt::message::Message for ListReferenceListsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListReferenceListsRequest"
    }
}

/// A response to a request for a list of reference lists.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListReferenceListsResponse {
    /// The reference lists.
    /// Ordered in ascending alphabetical order by name.
    pub reference_lists: std::vec::Vec<crate::model::ReferenceList>,

    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListReferenceListsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [reference_lists][crate::model::ListReferenceListsResponse::reference_lists].
    pub fn set_reference_lists<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ReferenceList>,
    {
        use std::iter::Iterator;
        self.reference_lists = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListReferenceListsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListReferenceListsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListReferenceListsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListReferenceListsResponse {
    type PageItem = crate::model::ReferenceList;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.reference_lists
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// A request to create a reference list.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateReferenceListRequest {
    /// Required. The parent resource where this reference list will be created.
    /// Format: `projects/{project}/locations/{location}/instances/{instance}`
    pub parent: std::string::String,

    /// Required. The reference list to create.
    pub reference_list: std::option::Option<crate::model::ReferenceList>,

    /// Required. The ID to use for the reference list. This is also the display
    /// name for the reference list. It must satisfy the following requirements:
    ///
    /// - Starts with letter.
    /// - Contains only letters, numbers and underscore.
    /// - Has length less than 256.
    /// - Must be unique.
    pub reference_list_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateReferenceListRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateReferenceListRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [reference_list][crate::model::CreateReferenceListRequest::reference_list].
    pub fn set_reference_list<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ReferenceList>,
    {
        self.reference_list = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [reference_list][crate::model::CreateReferenceListRequest::reference_list].
    pub fn set_or_clear_reference_list<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ReferenceList>,
    {
        self.reference_list = v.map(|x| x.into());
        self
    }

    /// Sets the value of [reference_list_id][crate::model::CreateReferenceListRequest::reference_list_id].
    pub fn set_reference_list_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.reference_list_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateReferenceListRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.CreateReferenceListRequest"
    }
}

/// A request to update a reference list.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateReferenceListRequest {
    /// Required. The reference list to update.
    ///
    /// The reference list's `name` field is used to identify the reference list to
    /// update.
    /// Format:
    /// `projects/{project}/locations/{locations}/instances/{instance}/referenceLists/{reference_list}`
    pub reference_list: std::option::Option<crate::model::ReferenceList>,

    /// The list of fields to update.
    /// When no field mask is supplied, all non-empty fields will be updated.
    /// A field mask of "*" will update all fields, whether empty or not.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateReferenceListRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [reference_list][crate::model::UpdateReferenceListRequest::reference_list].
    pub fn set_reference_list<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ReferenceList>,
    {
        self.reference_list = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [reference_list][crate::model::UpdateReferenceListRequest::reference_list].
    pub fn set_or_clear_reference_list<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ReferenceList>,
    {
        self.reference_list = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateReferenceListRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateReferenceListRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateReferenceListRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.UpdateReferenceListRequest"
    }
}

/// A reference list.
/// Reference lists are user-defined lists of values which users can
/// use in multiple Rules.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReferenceList {
    /// Identifier. The resource name of the reference list.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/referenceLists/{reference_list}`
    pub name: std::string::String,

    /// Output only. The unique display name of the reference list.
    pub display_name: std::string::String,

    /// Output only. The timestamp when the reference list was last updated.
    pub revision_create_time: std::option::Option<wkt::Timestamp>,

    /// Required. A user-provided description of the reference list.
    pub description: std::string::String,

    /// Required. The entries of the reference list.
    /// When listed, they are returned in the order that was specified at creation
    /// or update. The combined size of the values of the reference list may not
    /// exceed 6MB.
    /// This is returned only when the view is REFERENCE_LIST_VIEW_FULL.
    pub entries: std::vec::Vec<crate::model::ReferenceListEntry>,

    /// Output only. The resource names for the associated self-authored Rules that
    /// use this reference list. This is returned only when the view is
    /// REFERENCE_LIST_VIEW_FULL.
    pub rules: std::vec::Vec<std::string::String>,

    /// Required. The syntax type indicating how list entries should be validated.
    pub syntax_type: crate::model::ReferenceListSyntaxType,

    /// Output only. The count of self-authored rules using the reference list.
    pub rule_associations_count: i32,

    /// The scope info of the reference list.
    /// During reference list creation, if this field is not set, the reference
    /// list without scopes (an unscoped list) will be created for an unscoped
    /// user. For a scoped user, this field must be set. During reference list
    /// update, if scope_info is requested to be updated, this field must be set.
    pub scope_info: std::option::Option<crate::model::ScopeInfo>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ReferenceList {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ReferenceList::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::ReferenceList::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [revision_create_time][crate::model::ReferenceList::revision_create_time].
    pub fn set_revision_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.revision_create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [revision_create_time][crate::model::ReferenceList::revision_create_time].
    pub fn set_or_clear_revision_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.revision_create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::ReferenceList::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [entries][crate::model::ReferenceList::entries].
    pub fn set_entries<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ReferenceListEntry>,
    {
        use std::iter::Iterator;
        self.entries = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [rules][crate::model::ReferenceList::rules].
    pub fn set_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.rules = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [syntax_type][crate::model::ReferenceList::syntax_type].
    pub fn set_syntax_type<T: std::convert::Into<crate::model::ReferenceListSyntaxType>>(
        mut self,
        v: T,
    ) -> Self {
        self.syntax_type = v.into();
        self
    }

    /// Sets the value of [rule_associations_count][crate::model::ReferenceList::rule_associations_count].
    pub fn set_rule_associations_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.rule_associations_count = v.into();
        self
    }

    /// Sets the value of [scope_info][crate::model::ReferenceList::scope_info].
    pub fn set_scope_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ScopeInfo>,
    {
        self.scope_info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [scope_info][crate::model::ReferenceList::scope_info].
    pub fn set_or_clear_scope_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ScopeInfo>,
    {
        self.scope_info = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for ReferenceList {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ReferenceList"
    }
}

/// An entry in a reference list.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReferenceListEntry {
    /// Required. The value of the entry. Maximum length is 512 characters.
    pub value: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ReferenceListEntry {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [value][crate::model::ReferenceListEntry::value].
    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.value = v.into();
        self
    }
}

impl wkt::message::Message for ReferenceListEntry {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ReferenceListEntry"
    }
}

/// The Rule resource represents a user-created rule.
/// NEXT TAG: 21
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Rule {
    /// Identifier. Full resource name for the rule.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
    pub name: std::string::String,

    /// Output only. The revision ID of the rule.
    /// A new revision is created whenever the rule text is changed in any way.
    /// Format: `v_{10 digits}_{9 digits}`
    /// Populated in REVISION_METADATA_ONLY view and FULL view.
    pub revision_id: std::string::String,

    /// Output only. Display name of the rule.
    /// Populated in BASIC view and FULL view.
    pub display_name: std::string::String,

    /// The YARA-L content of the rule.
    /// Populated in FULL view.
    pub text: std::string::String,

    /// Output only. The author of the rule. Extracted from the meta section of
    /// text. Populated in BASIC view and FULL view.
    pub author: std::string::String,

    /// Output only. The severity of the rule as specified in the meta section of
    /// text. Populated in BASIC view and FULL view.
    pub severity: std::option::Option<crate::model::Severity>,

    /// Output only. Additional metadata specified in the meta section of text.
    /// Populated in FULL view.
    pub metadata: std::collections::HashMap<std::string::String, std::string::String>,

    /// Output only. The timestamp of when the rule was created.
    /// Populated in FULL view.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp of when the rule revision was created.
    /// Populated in FULL, REVISION_METADATA_ONLY views.
    pub revision_create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The current compilation state of the rule.
    /// Populated in FULL view.
    pub compilation_state: crate::model::rule::CompilationState,

    /// Output only. User-facing type of the rule. Extracted from the events
    /// section of rule text. Populated in BASIC view and FULL view.
    pub r#type: crate::model::RuleType,

    /// Output only. Resource names of the reference lists used in this rule.
    /// Populated in FULL view.
    pub reference_lists: std::vec::Vec<std::string::String>,

    /// Output only. The run frequencies that are allowed for the rule.
    /// Populated in BASIC view and FULL view.
    pub allowed_run_frequencies: std::vec::Vec<crate::model::RunFrequency>,

    /// The etag for this rule.
    /// If this is provided on update, the request will succeed if and only if it
    /// matches the server-computed value, and will fail with an ABORTED error
    /// otherwise.
    /// Populated in BASIC view and FULL view.
    pub etag: std::string::String,

    /// Resource name of the DataAccessScope bound to this rule.
    /// Populated in BASIC view and FULL view.
    /// If reference lists are used in the rule, validations will be performed
    /// against this scope to ensure that the reference lists are compatible with
    /// both the user's and the rule's scopes.
    /// The scope should be in the format:
    /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{scope}`.
    pub scope: std::string::String,

    /// Output only. A list of a rule's corresponding compilation diagnostic
    /// messages such as compilation errors and compilation warnings. Populated in
    /// FULL view.
    pub compilation_diagnostics: std::vec::Vec<crate::model::CompilationDiagnostic>,

    /// Output only. Indicate the rule can run in near real time live rule.
    /// If this is true, the rule uses the near real time live rule when the run
    /// frequency is set to LIVE.
    pub near_real_time_live_rule_eligible: bool,

    /// Output only. The set of inputs used in the rule. For example, if the rule
    /// uses $e.principal.hostname, then the uses_udm field will be true.
    pub inputs_used: std::option::Option<crate::model::InputsUsed>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Rule {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Rule::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [revision_id][crate::model::Rule::revision_id].
    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.revision_id = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::Rule::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [text][crate::model::Rule::text].
    pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.text = v.into();
        self
    }

    /// Sets the value of [author][crate::model::Rule::author].
    pub fn set_author<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.author = v.into();
        self
    }

    /// Sets the value of [severity][crate::model::Rule::severity].
    pub fn set_severity<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Severity>,
    {
        self.severity = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [severity][crate::model::Rule::severity].
    pub fn set_or_clear_severity<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Severity>,
    {
        self.severity = v.map(|x| x.into());
        self
    }

    /// Sets the value of [metadata][crate::model::Rule::metadata].
    pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [create_time][crate::model::Rule::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Rule::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [revision_create_time][crate::model::Rule::revision_create_time].
    pub fn set_revision_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.revision_create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [revision_create_time][crate::model::Rule::revision_create_time].
    pub fn set_or_clear_revision_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.revision_create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [compilation_state][crate::model::Rule::compilation_state].
    pub fn set_compilation_state<T: std::convert::Into<crate::model::rule::CompilationState>>(
        mut self,
        v: T,
    ) -> Self {
        self.compilation_state = v.into();
        self
    }

    /// Sets the value of [r#type][crate::model::Rule::type].
    pub fn set_type<T: std::convert::Into<crate::model::RuleType>>(mut self, v: T) -> Self {
        self.r#type = v.into();
        self
    }

    /// Sets the value of [reference_lists][crate::model::Rule::reference_lists].
    pub fn set_reference_lists<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.reference_lists = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [allowed_run_frequencies][crate::model::Rule::allowed_run_frequencies].
    pub fn set_allowed_run_frequencies<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::RunFrequency>,
    {
        use std::iter::Iterator;
        self.allowed_run_frequencies = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [etag][crate::model::Rule::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [scope][crate::model::Rule::scope].
    pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.scope = v.into();
        self
    }

    /// Sets the value of [compilation_diagnostics][crate::model::Rule::compilation_diagnostics].
    pub fn set_compilation_diagnostics<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::CompilationDiagnostic>,
    {
        use std::iter::Iterator;
        self.compilation_diagnostics = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [near_real_time_live_rule_eligible][crate::model::Rule::near_real_time_live_rule_eligible].
    pub fn set_near_real_time_live_rule_eligible<T: std::convert::Into<bool>>(
        mut self,
        v: T,
    ) -> Self {
        self.near_real_time_live_rule_eligible = v.into();
        self
    }

    /// Sets the value of [inputs_used][crate::model::Rule::inputs_used].
    pub fn set_inputs_used<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::InputsUsed>,
    {
        self.inputs_used = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [inputs_used][crate::model::Rule::inputs_used].
    pub fn set_or_clear_inputs_used<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::InputsUsed>,
    {
        self.inputs_used = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for Rule {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.Rule"
    }
}

/// Defines additional types related to [Rule].
pub mod rule {
    #[allow(unused_imports)]
    use super::*;

    /// The current compilation state of the rule.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum CompilationState {
        /// The compilation state is unspecified/unknown.
        Unspecified,
        /// The Rule can successfully compile.
        Succeeded,
        /// The Rule cannot successfully compile.
        /// This is possible if a backwards-incompatible change was made to the
        /// compiler.
        Failed,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [CompilationState::value] or
        /// [CompilationState::name].
        UnknownValue(compilation_state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod compilation_state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl CompilationState {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Succeeded => std::option::Option::Some(1),
                Self::Failed => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("COMPILATION_STATE_UNSPECIFIED"),
                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for CompilationState {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for CompilationState {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for CompilationState {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Succeeded,
                2 => Self::Failed,
                _ => Self::UnknownValue(compilation_state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for CompilationState {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "COMPILATION_STATE_UNSPECIFIED" => Self::Unspecified,
                "SUCCEEDED" => Self::Succeeded,
                "FAILED" => Self::Failed,
                _ => Self::UnknownValue(compilation_state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for CompilationState {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Succeeded => serializer.serialize_i32(1),
                Self::Failed => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for CompilationState {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompilationState>::new(
                ".google.cloud.chronicle.v1.Rule.CompilationState",
            ))
        }
    }
}

/// The RuleDeployment resource represents the deployment state of a Rule.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RuleDeployment {
    /// Required. The resource name of the rule deployment.
    /// Note that RuleDeployment is a child of the overall Rule, not any individual
    /// revision, so the resource ID segment for the Rule resource must not
    /// reference a specific revision.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/deployment`
    pub name: std::string::String,

    /// Whether the rule is currently deployed continuously against incoming data.
    pub enabled: bool,

    /// Whether detections resulting from this deployment should be considered
    /// alerts.
    pub alerting: bool,

    /// The archive state of the rule deployment.
    /// Cannot be set to true unless enabled is set to false.
    /// If set to true, alerting will automatically be set to false.
    /// If currently set to true, enabled, alerting, and run_frequency cannot be
    /// updated.
    pub archived: bool,

    /// Output only. The timestamp when the rule deployment archive state was last
    /// set to true. If the rule deployment's current archive state is not set to
    /// true, the field will be empty.
    pub archive_time: std::option::Option<wkt::Timestamp>,

    /// The run frequency of the rule deployment.
    pub run_frequency: crate::model::RunFrequency,

    /// Output only. The execution state of the rule deployment.
    pub execution_state: crate::model::rule_deployment::ExecutionState,

    /// Output only. The names of the associated/chained producer rules. Rules are
    /// considered producers for this rule if this rule explicitly filters on their
    /// ruleid. Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
    pub producer_rules: std::vec::Vec<std::string::String>,

    /// Output only. The names of the associated/chained consumer rules. Rules are
    /// considered consumers of this rule if their rule text explicitly filters on
    /// this rule's ruleid. Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
    pub consumer_rules: std::vec::Vec<std::string::String>,

    /// Output only. The timestamp when the rule deployment alert state was lastly
    /// changed. This is filled regardless of the current alert state. E.g. if the
    /// current alert status is false, this timestamp will be the timestamp when
    /// the alert status was changed to false.
    pub last_alert_status_change_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RuleDeployment {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::RuleDeployment::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [enabled][crate::model::RuleDeployment::enabled].
    pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.enabled = v.into();
        self
    }

    /// Sets the value of [alerting][crate::model::RuleDeployment::alerting].
    pub fn set_alerting<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.alerting = v.into();
        self
    }

    /// Sets the value of [archived][crate::model::RuleDeployment::archived].
    pub fn set_archived<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.archived = v.into();
        self
    }

    /// Sets the value of [archive_time][crate::model::RuleDeployment::archive_time].
    pub fn set_archive_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.archive_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [archive_time][crate::model::RuleDeployment::archive_time].
    pub fn set_or_clear_archive_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.archive_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [run_frequency][crate::model::RuleDeployment::run_frequency].
    pub fn set_run_frequency<T: std::convert::Into<crate::model::RunFrequency>>(
        mut self,
        v: T,
    ) -> Self {
        self.run_frequency = v.into();
        self
    }

    /// Sets the value of [execution_state][crate::model::RuleDeployment::execution_state].
    pub fn set_execution_state<
        T: std::convert::Into<crate::model::rule_deployment::ExecutionState>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.execution_state = v.into();
        self
    }

    /// Sets the value of [producer_rules][crate::model::RuleDeployment::producer_rules].
    pub fn set_producer_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.producer_rules = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [consumer_rules][crate::model::RuleDeployment::consumer_rules].
    pub fn set_consumer_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.consumer_rules = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [last_alert_status_change_time][crate::model::RuleDeployment::last_alert_status_change_time].
    pub fn set_last_alert_status_change_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.last_alert_status_change_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [last_alert_status_change_time][crate::model::RuleDeployment::last_alert_status_change_time].
    pub fn set_or_clear_last_alert_status_change_time<T>(
        mut self,
        v: std::option::Option<T>,
    ) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.last_alert_status_change_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for RuleDeployment {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.RuleDeployment"
    }
}

/// Defines additional types related to [RuleDeployment].
pub mod rule_deployment {
    #[allow(unused_imports)]
    use super::*;

    /// The possible execution states the rule deployment can be in.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum ExecutionState {
        /// Unspecified or unknown execution state.
        Unspecified,
        /// Default execution state.
        Default,
        /// Rules in limited state may not have their executions guaranteed.
        Limited,
        /// Paused rules are not executed at all.
        Paused,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [ExecutionState::value] or
        /// [ExecutionState::name].
        UnknownValue(execution_state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod execution_state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl ExecutionState {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Default => std::option::Option::Some(1),
                Self::Limited => std::option::Option::Some(2),
                Self::Paused => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("EXECUTION_STATE_UNSPECIFIED"),
                Self::Default => std::option::Option::Some("DEFAULT"),
                Self::Limited => std::option::Option::Some("LIMITED"),
                Self::Paused => std::option::Option::Some("PAUSED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for ExecutionState {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for ExecutionState {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for ExecutionState {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Default,
                2 => Self::Limited,
                3 => Self::Paused,
                _ => Self::UnknownValue(execution_state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for ExecutionState {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "EXECUTION_STATE_UNSPECIFIED" => Self::Unspecified,
                "DEFAULT" => Self::Default,
                "LIMITED" => Self::Limited,
                "PAUSED" => Self::Paused,
                _ => Self::UnknownValue(execution_state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for ExecutionState {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Default => serializer.serialize_i32(1),
                Self::Limited => serializer.serialize_i32(2),
                Self::Paused => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for ExecutionState {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionState>::new(
                ".google.cloud.chronicle.v1.RuleDeployment.ExecutionState",
            ))
        }
    }
}

/// Retrohunt is an execution of a Rule over a time range in the past.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Retrohunt {
    /// The resource name of the retrohunt.
    /// Retrohunt is the child of a rule revision. {rule} in the format below is
    /// structured as {rule_id@revision_id}.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/retrohunts/{retrohunt}`
    pub name: std::string::String,

    /// Required. The start and end time of the event time range this retrohunt
    /// processes.
    pub process_interval: std::option::Option<gtype::model::Interval>,

    /// Output only. The start and end time of the retrohunt execution. If the
    /// retrohunt is not yet finished, the end time of the interval will not be
    /// populated.
    pub execution_interval: std::option::Option<gtype::model::Interval>,

    /// Output only. The state of the retrohunt.
    pub state: crate::model::retrohunt::State,

    /// Output only. Percent progress of the retrohunt towards completion, from
    /// 0.00 to 100.00.
    pub progress_percentage: f32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Retrohunt {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Retrohunt::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [process_interval][crate::model::Retrohunt::process_interval].
    pub fn set_process_interval<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<gtype::model::Interval>,
    {
        self.process_interval = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [process_interval][crate::model::Retrohunt::process_interval].
    pub fn set_or_clear_process_interval<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<gtype::model::Interval>,
    {
        self.process_interval = v.map(|x| x.into());
        self
    }

    /// Sets the value of [execution_interval][crate::model::Retrohunt::execution_interval].
    pub fn set_execution_interval<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<gtype::model::Interval>,
    {
        self.execution_interval = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [execution_interval][crate::model::Retrohunt::execution_interval].
    pub fn set_or_clear_execution_interval<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<gtype::model::Interval>,
    {
        self.execution_interval = v.map(|x| x.into());
        self
    }

    /// Sets the value of [state][crate::model::Retrohunt::state].
    pub fn set_state<T: std::convert::Into<crate::model::retrohunt::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [progress_percentage][crate::model::Retrohunt::progress_percentage].
    pub fn set_progress_percentage<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
        self.progress_percentage = v.into();
        self
    }
}

impl wkt::message::Message for Retrohunt {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.Retrohunt"
    }
}

/// Defines additional types related to [Retrohunt].
pub mod retrohunt {
    #[allow(unused_imports)]
    use super::*;

    /// The possible states a retrohunt can be in.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Unspecified or unknown retrohunt state.
        Unspecified,
        /// Running state.
        Running,
        /// Done state.
        Done,
        /// Cancelled state.
        Cancelled,
        /// Failed state.
        Failed,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Running => std::option::Option::Some(1),
                Self::Done => std::option::Option::Some(2),
                Self::Cancelled => std::option::Option::Some(3),
                Self::Failed => std::option::Option::Some(4),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Running => std::option::Option::Some("RUNNING"),
                Self::Done => std::option::Option::Some("DONE"),
                Self::Cancelled => std::option::Option::Some("CANCELLED"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Running,
                2 => Self::Done,
                3 => Self::Cancelled,
                4 => Self::Failed,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "RUNNING" => Self::Running,
                "DONE" => Self::Done,
                "CANCELLED" => Self::Cancelled,
                "FAILED" => Self::Failed,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Running => serializer.serialize_i32(1),
                Self::Done => serializer.serialize_i32(2),
                Self::Cancelled => serializer.serialize_i32(3),
                Self::Failed => serializer.serialize_i32(4),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.chronicle.v1.Retrohunt.State",
            ))
        }
    }
}

/// Request message for CreateRule method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateRuleRequest {
    /// Required. The parent resource where this rule will be created.
    /// Format: `projects/{project}/locations/{location}/instances/{instance}`
    pub parent: std::string::String,

    /// Required. The rule to create.
    pub rule: std::option::Option<crate::model::Rule>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateRuleRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateRuleRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [rule][crate::model::CreateRuleRequest::rule].
    pub fn set_rule<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Rule>,
    {
        self.rule = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [rule][crate::model::CreateRuleRequest::rule].
    pub fn set_or_clear_rule<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Rule>,
    {
        self.rule = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateRuleRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.CreateRuleRequest"
    }
}

/// Request message for GetRule method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRuleRequest {
    /// Required. The name of the rule to retrieve.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
    pub name: std::string::String,

    /// The view field indicates the scope of fields to populate for the Rule being
    /// returned. If unspecified, defaults to FULL.
    pub view: crate::model::RuleView,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetRuleRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetRuleRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [view][crate::model::GetRuleRequest::view].
    pub fn set_view<T: std::convert::Into<crate::model::RuleView>>(mut self, v: T) -> Self {
        self.view = v.into();
        self
    }
}

impl wkt::message::Message for GetRuleRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.GetRuleRequest"
    }
}

/// Request message for ListRules method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRulesRequest {
    /// Required. The parent, which owns this collection of rules.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}`
    pub parent: std::string::String,

    /// The maximum number of rules to return. The service may return fewer than
    /// this value. If unspecified, at most 100 rules will be returned. The
    /// maximum value is 1000; values above 1000 will be coerced to 1000.
    pub page_size: i32,

    /// A page token, received from a previous `ListRules` call.
    /// Provide this to retrieve the subsequent page.
    ///
    /// When paginating, all other parameters provided to `ListRules`
    /// must match the call that provided the page token.
    pub page_token: std::string::String,

    /// view indicates the scope of fields to populate for the Rule being returned.
    /// If unspecified, defaults to BASIC.
    pub view: crate::model::RuleView,

    /// Only the following filters are allowed:
    /// "reference_lists:{reference_list_name}"
    /// "data_tables:{data_table_name}"
    /// "display_name:{display_name}"
    pub filter: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRulesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListRulesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListRulesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListRulesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [view][crate::model::ListRulesRequest::view].
    pub fn set_view<T: std::convert::Into<crate::model::RuleView>>(mut self, v: T) -> Self {
        self.view = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListRulesRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }
}

impl wkt::message::Message for ListRulesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListRulesRequest"
    }
}

/// Response message for ListRules method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRulesResponse {
    /// The rules from the specified instance.
    pub rules: std::vec::Vec<crate::model::Rule>,

    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRulesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [rules][crate::model::ListRulesResponse::rules].
    pub fn set_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Rule>,
    {
        use std::iter::Iterator;
        self.rules = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListRulesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListRulesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListRulesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListRulesResponse {
    type PageItem = crate::model::Rule;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.rules
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for UpdateRule method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateRuleRequest {
    /// Required. The rule to update.
    ///
    /// The rule's `name` field is used to identify the rule to update.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
    pub rule: std::option::Option<crate::model::Rule>,

    /// The list of fields to update. If not included, all fields with a non-empty
    /// value will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateRuleRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [rule][crate::model::UpdateRuleRequest::rule].
    pub fn set_rule<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Rule>,
    {
        self.rule = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [rule][crate::model::UpdateRuleRequest::rule].
    pub fn set_or_clear_rule<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Rule>,
    {
        self.rule = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateRuleRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateRuleRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateRuleRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.UpdateRuleRequest"
    }
}

/// Request message for the DeleteRule method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteRuleRequest {
    /// Required. The name of the rule to delete. A rule revision timestamp cannot
    /// be specified as part of the name, as deleting specific revisions is not
    /// supported.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
    pub name: std::string::String,

    /// Optional. If set to true, any retrohunts and any detections associated with
    /// the rule will also be deleted. If set to false, the call will only succeed
    /// if the rule has no associated retrohunts, including completed retrohunts,
    /// and no associated detections. Regardless of this field's value, the rule
    /// deployment associated with this rule will also be deleted.
    pub force: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteRuleRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteRuleRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [force][crate::model::DeleteRuleRequest::force].
    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.force = v.into();
        self
    }
}

impl wkt::message::Message for DeleteRuleRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.DeleteRuleRequest"
    }
}

/// Request message for ListRuleRevisions method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRuleRevisionsRequest {
    /// Required. The name of the rule to list revisions for.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
    pub name: std::string::String,

    /// The maximum number of revisions to return per page. The service may return
    /// fewer than this value. If unspecified, at most 100 revisions will be
    /// returned. The maximum value is 1000; values above 1000 will be coerced to
    /// 1000.
    pub page_size: i32,

    /// The page token, received from a previous `ListRuleRevisions` call.
    /// Provide this to retrieve the subsequent page.
    ///
    /// When paginating, all other parameters provided to `ListRuleRevisions`
    /// must match the call that provided the page token.
    pub page_token: std::string::String,

    /// The view field indicates the scope of fields to populate for the revision
    /// being returned. If unspecified, defaults to BASIC.
    pub view: crate::model::RuleView,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRuleRevisionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ListRuleRevisionsRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListRuleRevisionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListRuleRevisionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [view][crate::model::ListRuleRevisionsRequest::view].
    pub fn set_view<T: std::convert::Into<crate::model::RuleView>>(mut self, v: T) -> Self {
        self.view = v.into();
        self
    }
}

impl wkt::message::Message for ListRuleRevisionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListRuleRevisionsRequest"
    }
}

/// Response message for ListRuleRevisions method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRuleRevisionsResponse {
    /// The revisions of the rule.
    pub rules: std::vec::Vec<crate::model::Rule>,

    /// A token that can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRuleRevisionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [rules][crate::model::ListRuleRevisionsResponse::rules].
    pub fn set_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Rule>,
    {
        use std::iter::Iterator;
        self.rules = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListRuleRevisionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListRuleRevisionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListRuleRevisionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListRuleRevisionsResponse {
    type PageItem = crate::model::Rule;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.rules
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for CreateRetrohunt method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateRetrohuntRequest {
    /// Required. The parent of retrohunt, which is a rule.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
    pub parent: std::string::String,

    /// Required. The retrohunt to create.
    pub retrohunt: std::option::Option<crate::model::Retrohunt>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateRetrohuntRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateRetrohuntRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [retrohunt][crate::model::CreateRetrohuntRequest::retrohunt].
    pub fn set_retrohunt<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Retrohunt>,
    {
        self.retrohunt = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [retrohunt][crate::model::CreateRetrohuntRequest::retrohunt].
    pub fn set_or_clear_retrohunt<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Retrohunt>,
    {
        self.retrohunt = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateRetrohuntRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.CreateRetrohuntRequest"
    }
}

/// Request message for GetRetrohunt method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRetrohuntRequest {
    /// Required. The name of the retrohunt to retrieve.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/retrohunts/{retrohunt}`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetRetrohuntRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetRetrohuntRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetRetrohuntRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.GetRetrohuntRequest"
    }
}

/// Request message for ListRetrohunts method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRetrohuntsRequest {
    /// Required. The rule that the retrohunts belong to.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
    pub parent: std::string::String,

    /// The maximum number of retrohunt to return. The service may return fewer
    /// than this value. If unspecified, at most 100 retrohunts will be returned.
    /// The maximum value is 1000; values above 1000 will be coerced to
    /// 1000.
    pub page_size: i32,

    /// A page token, received from a previous `ListRetrohunts` call.
    /// Provide this to retrieve the subsequent page.
    ///
    /// When paginating, all other parameters provided to `ListRetrohunts` must
    /// match the call that provided the page token.
    pub page_token: std::string::String,

    /// A filter that can be used to retrieve specific rule deployments.
    /// The following fields are filterable:
    /// state
    pub filter: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRetrohuntsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListRetrohuntsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListRetrohuntsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListRetrohuntsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListRetrohuntsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }
}

impl wkt::message::Message for ListRetrohuntsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListRetrohuntsRequest"
    }
}

/// Response message for ListRetrohunts method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRetrohuntsResponse {
    /// The retrohunts from the specified rule.
    pub retrohunts: std::vec::Vec<crate::model::Retrohunt>,

    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRetrohuntsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [retrohunts][crate::model::ListRetrohuntsResponse::retrohunts].
    pub fn set_retrohunts<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Retrohunt>,
    {
        use std::iter::Iterator;
        self.retrohunts = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListRetrohuntsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListRetrohuntsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListRetrohuntsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListRetrohuntsResponse {
    type PageItem = crate::model::Retrohunt;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.retrohunts
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for GetRuleDeployment.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRuleDeploymentRequest {
    /// Required. The name of the rule deployment to retrieve.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/deployment`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetRuleDeploymentRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetRuleDeploymentRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetRuleDeploymentRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.GetRuleDeploymentRequest"
    }
}

/// Request message for ListRuleDeployments.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRuleDeploymentsRequest {
    /// Required. The collection of all parents which own all rule deployments. The
    /// "-" wildcard token must be used as the rule identifier in the resource
    /// path. Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/-`
    pub parent: std::string::String,

    /// The maximum number of rule deployments to return. The service may return
    /// fewer than this value. If unspecified, at most 100 rule deployments will be
    /// returned. The maximum value is 1000; values above 1000 will be coerced to
    /// 1000.
    pub page_size: i32,

    /// A page token, received from a previous `ListRuleDeployments` call.
    /// Provide this to retrieve the subsequent page.
    ///
    /// When paginating, all other parameters provided to `ListRuleDeployments`
    /// must match the call that provided the page token.
    pub page_token: std::string::String,

    /// A filter that can be used to retrieve specific rule deployments.
    /// The following fields are filterable:
    /// archived, name
    pub filter: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRuleDeploymentsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListRuleDeploymentsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListRuleDeploymentsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListRuleDeploymentsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListRuleDeploymentsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }
}

impl wkt::message::Message for ListRuleDeploymentsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListRuleDeploymentsRequest"
    }
}

/// Response message for ListRuleDeployments.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRuleDeploymentsResponse {
    /// The rule deployments from all rules.
    pub rule_deployments: std::vec::Vec<crate::model::RuleDeployment>,

    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRuleDeploymentsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [rule_deployments][crate::model::ListRuleDeploymentsResponse::rule_deployments].
    pub fn set_rule_deployments<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::RuleDeployment>,
    {
        use std::iter::Iterator;
        self.rule_deployments = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListRuleDeploymentsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListRuleDeploymentsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.ListRuleDeploymentsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListRuleDeploymentsResponse {
    type PageItem = crate::model::RuleDeployment;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.rule_deployments
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for UpdateRuleDeployment.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateRuleDeploymentRequest {
    /// Required. The rule deployment to update.
    ///
    /// The rule deployment's `name` field is used to identify the rule deployment
    /// to update. Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/deployment`
    pub rule_deployment: std::option::Option<crate::model::RuleDeployment>,

    /// Required. The list of fields to update.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateRuleDeploymentRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [rule_deployment][crate::model::UpdateRuleDeploymentRequest::rule_deployment].
    pub fn set_rule_deployment<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::RuleDeployment>,
    {
        self.rule_deployment = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [rule_deployment][crate::model::UpdateRuleDeploymentRequest::rule_deployment].
    pub fn set_or_clear_rule_deployment<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::RuleDeployment>,
    {
        self.rule_deployment = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateRuleDeploymentRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateRuleDeploymentRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateRuleDeploymentRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.UpdateRuleDeploymentRequest"
    }
}

/// CompilationPosition represents the location of a compilation diagnostic in
/// rule text.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CompilationPosition {
    /// Output only. Start line number, beginning at 1.
    pub start_line: i32,

    /// Output only. Start column number, beginning at 1.
    pub start_column: i32,

    /// Output only. End line number, beginning at 1.
    pub end_line: i32,

    /// Output only. End column number, beginning at 1.
    pub end_column: i32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CompilationPosition {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [start_line][crate::model::CompilationPosition::start_line].
    pub fn set_start_line<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.start_line = v.into();
        self
    }

    /// Sets the value of [start_column][crate::model::CompilationPosition::start_column].
    pub fn set_start_column<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.start_column = v.into();
        self
    }

    /// Sets the value of [end_line][crate::model::CompilationPosition::end_line].
    pub fn set_end_line<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.end_line = v.into();
        self
    }

    /// Sets the value of [end_column][crate::model::CompilationPosition::end_column].
    pub fn set_end_column<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.end_column = v.into();
        self
    }
}

impl wkt::message::Message for CompilationPosition {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.CompilationPosition"
    }
}

/// CompilationDiagnostic represents a compilation diagnostic generated
/// during a rule's compilation, such as a compilation error or a compilation
/// warning.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CompilationDiagnostic {
    /// Output only. The diagnostic message.
    pub message: std::string::String,

    /// Output only. The approximate position in the rule text associated with the
    /// compilation diagnostic.
    /// Compilation Position may be empty.
    pub position: std::option::Option<crate::model::CompilationPosition>,

    /// Output only. The severity of a rule's compilation diagnostic.
    pub severity: crate::model::compilation_diagnostic::Severity,

    /// Output only. Link to documentation that describes a diagnostic in more
    /// detail.
    pub uri: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CompilationDiagnostic {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [message][crate::model::CompilationDiagnostic::message].
    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.message = v.into();
        self
    }

    /// Sets the value of [position][crate::model::CompilationDiagnostic::position].
    pub fn set_position<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CompilationPosition>,
    {
        self.position = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [position][crate::model::CompilationDiagnostic::position].
    pub fn set_or_clear_position<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CompilationPosition>,
    {
        self.position = v.map(|x| x.into());
        self
    }

    /// Sets the value of [severity][crate::model::CompilationDiagnostic::severity].
    pub fn set_severity<T: std::convert::Into<crate::model::compilation_diagnostic::Severity>>(
        mut self,
        v: T,
    ) -> Self {
        self.severity = v.into();
        self
    }

    /// Sets the value of [uri][crate::model::CompilationDiagnostic::uri].
    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uri = v.into();
        self
    }
}

impl wkt::message::Message for CompilationDiagnostic {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.CompilationDiagnostic"
    }
}

/// Defines additional types related to [CompilationDiagnostic].
pub mod compilation_diagnostic {
    #[allow(unused_imports)]
    use super::*;

    /// The severity level of the compilation diagnostic.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Severity {
        /// An unspecified severity level.
        Unspecified,
        /// A compilation warning.
        Warning,
        /// A compilation error.
        Error,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Severity::value] or
        /// [Severity::name].
        UnknownValue(severity::UnknownValue),
    }

    #[doc(hidden)]
    pub mod severity {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Severity {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Warning => std::option::Option::Some(1),
                Self::Error => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
                Self::Warning => std::option::Option::Some("WARNING"),
                Self::Error => std::option::Option::Some("ERROR"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Severity {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Severity {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Severity {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Warning,
                2 => Self::Error,
                _ => Self::UnknownValue(severity::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Severity {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
                "WARNING" => Self::Warning,
                "ERROR" => Self::Error,
                _ => Self::UnknownValue(severity::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Severity {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Warning => serializer.serialize_i32(1),
                Self::Error => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Severity {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
                ".google.cloud.chronicle.v1.CompilationDiagnostic.Severity",
            ))
        }
    }
}

/// Severity represents the severity level of the rule.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Severity {
    /// The display name of the severity level. Extracted from the meta section of
    /// the rule text.
    pub display_name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Severity {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [display_name][crate::model::Severity::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }
}

impl wkt::message::Message for Severity {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.Severity"
    }
}

/// Operation Metadata for Retrohunts.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RetrohuntMetadata {
    /// The name of the retrohunt.
    /// Format:
    /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/retrohunts/{retrohunt}`
    pub retrohunt: std::string::String,

    /// The start and end time of the retrohunt execution. If the retrohunt is not
    /// yet finished, the end time of the interval will not be filled.
    pub execution_interval: std::option::Option<gtype::model::Interval>,

    /// Percent progress of the retrohunt towards completion, from 0.00 to 100.00.
    pub progress_percentage: f32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RetrohuntMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [retrohunt][crate::model::RetrohuntMetadata::retrohunt].
    pub fn set_retrohunt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.retrohunt = v.into();
        self
    }

    /// Sets the value of [execution_interval][crate::model::RetrohuntMetadata::execution_interval].
    pub fn set_execution_interval<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<gtype::model::Interval>,
    {
        self.execution_interval = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [execution_interval][crate::model::RetrohuntMetadata::execution_interval].
    pub fn set_or_clear_execution_interval<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<gtype::model::Interval>,
    {
        self.execution_interval = v.map(|x| x.into());
        self
    }

    /// Sets the value of [progress_percentage][crate::model::RetrohuntMetadata::progress_percentage].
    pub fn set_progress_percentage<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
        self.progress_percentage = v.into();
        self
    }
}

impl wkt::message::Message for RetrohuntMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.RetrohuntMetadata"
    }
}

/// InputsUsed is a convenience field that tells us which sources
/// of events (if any) were used in the rule.
/// NEXT TAG: 4
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InputsUsed {
    /// Optional. Whether the rule queries UDM events.
    pub uses_udm: bool,

    /// Optional. Whether the rule queries entity events.
    pub uses_entity: bool,

    /// Optional. Whether the rule queries detections.
    pub uses_detection: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl InputsUsed {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [uses_udm][crate::model::InputsUsed::uses_udm].
    pub fn set_uses_udm<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.uses_udm = v.into();
        self
    }

    /// Sets the value of [uses_entity][crate::model::InputsUsed::uses_entity].
    pub fn set_uses_entity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.uses_entity = v.into();
        self
    }

    /// Sets the value of [uses_detection][crate::model::InputsUsed::uses_detection].
    pub fn set_uses_detection<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.uses_detection = v.into();
        self
    }
}

impl wkt::message::Message for InputsUsed {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.chronicle.v1.InputsUsed"
    }
}

/// The syntax type indicating how list entries should be validated.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ReferenceListSyntaxType {
    /// Defaults to REFERENCE_LIST_SYNTAX_TYPE_PLAIN_TEXT_STRING.
    Unspecified,
    /// List contains plain text patterns.
    PlainTextString,
    /// List contains only Regular Expression patterns.
    Regex,
    /// List contains only CIDR patterns.
    Cidr,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [ReferenceListSyntaxType::value] or
    /// [ReferenceListSyntaxType::name].
    UnknownValue(reference_list_syntax_type::UnknownValue),
}

#[doc(hidden)]
pub mod reference_list_syntax_type {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl ReferenceListSyntaxType {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::PlainTextString => std::option::Option::Some(1),
            Self::Regex => std::option::Option::Some(2),
            Self::Cidr => std::option::Option::Some(3),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => {
                std::option::Option::Some("REFERENCE_LIST_SYNTAX_TYPE_UNSPECIFIED")
            }
            Self::PlainTextString => {
                std::option::Option::Some("REFERENCE_LIST_SYNTAX_TYPE_PLAIN_TEXT_STRING")
            }
            Self::Regex => std::option::Option::Some("REFERENCE_LIST_SYNTAX_TYPE_REGEX"),
            Self::Cidr => std::option::Option::Some("REFERENCE_LIST_SYNTAX_TYPE_CIDR"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for ReferenceListSyntaxType {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for ReferenceListSyntaxType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for ReferenceListSyntaxType {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::PlainTextString,
            2 => Self::Regex,
            3 => Self::Cidr,
            _ => Self::UnknownValue(reference_list_syntax_type::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for ReferenceListSyntaxType {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "REFERENCE_LIST_SYNTAX_TYPE_UNSPECIFIED" => Self::Unspecified,
            "REFERENCE_LIST_SYNTAX_TYPE_PLAIN_TEXT_STRING" => Self::PlainTextString,
            "REFERENCE_LIST_SYNTAX_TYPE_REGEX" => Self::Regex,
            "REFERENCE_LIST_SYNTAX_TYPE_CIDR" => Self::Cidr,
            _ => Self::UnknownValue(reference_list_syntax_type::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for ReferenceListSyntaxType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::PlainTextString => serializer.serialize_i32(1),
            Self::Regex => serializer.serialize_i32(2),
            Self::Cidr => serializer.serialize_i32(3),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for ReferenceListSyntaxType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReferenceListSyntaxType>::new(
            ".google.cloud.chronicle.v1.ReferenceListSyntaxType",
        ))
    }
}

/// ReferenceListView is a mechanism for viewing partial responses of the
/// ReferenceList resource.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ReferenceListView {
    /// The default / unset value.
    /// The API will default to the BASIC view for ListReferenceLists.
    /// The API will default to the FULL view for methods that return a single
    /// ReferenceList resource.
    Unspecified,
    /// Include metadata about the ReferenceList.
    /// This is the default view for ListReferenceLists.
    Basic,
    /// Include all details about the ReferenceList: metadata, content lines,
    /// associated rule counts. This is the default view for GetReferenceList.
    Full,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [ReferenceListView::value] or
    /// [ReferenceListView::name].
    UnknownValue(reference_list_view::UnknownValue),
}

#[doc(hidden)]
pub mod reference_list_view {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl ReferenceListView {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Basic => std::option::Option::Some(1),
            Self::Full => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("REFERENCE_LIST_VIEW_UNSPECIFIED"),
            Self::Basic => std::option::Option::Some("REFERENCE_LIST_VIEW_BASIC"),
            Self::Full => std::option::Option::Some("REFERENCE_LIST_VIEW_FULL"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for ReferenceListView {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for ReferenceListView {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for ReferenceListView {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Basic,
            2 => Self::Full,
            _ => Self::UnknownValue(reference_list_view::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for ReferenceListView {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "REFERENCE_LIST_VIEW_UNSPECIFIED" => Self::Unspecified,
            "REFERENCE_LIST_VIEW_BASIC" => Self::Basic,
            "REFERENCE_LIST_VIEW_FULL" => Self::Full,
            _ => Self::UnknownValue(reference_list_view::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for ReferenceListView {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Basic => serializer.serialize_i32(1),
            Self::Full => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for ReferenceListView {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReferenceListView>::new(
            ".google.cloud.chronicle.v1.ReferenceListView",
        ))
    }
}

/// RunFrequency indicates the run frequency at which a YARA-L 2 rule will run if
/// enabled.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RunFrequency {
    /// The run frequency is unspecified/unknown.
    Unspecified,
    /// Executes in real time.
    Live,
    /// Executes once per hour.
    Hourly,
    /// Executes once per day.
    Daily,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [RunFrequency::value] or
    /// [RunFrequency::name].
    UnknownValue(run_frequency::UnknownValue),
}

#[doc(hidden)]
pub mod run_frequency {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl RunFrequency {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Live => std::option::Option::Some(1),
            Self::Hourly => std::option::Option::Some(2),
            Self::Daily => std::option::Option::Some(3),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("RUN_FREQUENCY_UNSPECIFIED"),
            Self::Live => std::option::Option::Some("LIVE"),
            Self::Hourly => std::option::Option::Some("HOURLY"),
            Self::Daily => std::option::Option::Some("DAILY"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for RunFrequency {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for RunFrequency {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for RunFrequency {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Live,
            2 => Self::Hourly,
            3 => Self::Daily,
            _ => Self::UnknownValue(run_frequency::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for RunFrequency {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "RUN_FREQUENCY_UNSPECIFIED" => Self::Unspecified,
            "LIVE" => Self::Live,
            "HOURLY" => Self::Hourly,
            "DAILY" => Self::Daily,
            _ => Self::UnknownValue(run_frequency::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for RunFrequency {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Live => serializer.serialize_i32(1),
            Self::Hourly => serializer.serialize_i32(2),
            Self::Daily => serializer.serialize_i32(3),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for RunFrequency {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<RunFrequency>::new(
            ".google.cloud.chronicle.v1.RunFrequency",
        ))
    }
}

/// RuleType indicates the YARA-L rule type of user-created and Google Cloud
/// Threat Intelligence (GCTI) authored rules.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RuleType {
    /// The rule type is unspecified/unknown.
    Unspecified,
    /// Rule checks for the existence of a single event.
    SingleEvent,
    /// Rule checks for correlation between multiple events
    MultiEvent,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [RuleType::value] or
    /// [RuleType::name].
    UnknownValue(rule_type::UnknownValue),
}

#[doc(hidden)]
pub mod rule_type {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl RuleType {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::SingleEvent => std::option::Option::Some(1),
            Self::MultiEvent => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("RULE_TYPE_UNSPECIFIED"),
            Self::SingleEvent => std::option::Option::Some("SINGLE_EVENT"),
            Self::MultiEvent => std::option::Option::Some("MULTI_EVENT"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for RuleType {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for RuleType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for RuleType {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::SingleEvent,
            2 => Self::MultiEvent,
            _ => Self::UnknownValue(rule_type::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for RuleType {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "RULE_TYPE_UNSPECIFIED" => Self::Unspecified,
            "SINGLE_EVENT" => Self::SingleEvent,
            "MULTI_EVENT" => Self::MultiEvent,
            _ => Self::UnknownValue(rule_type::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for RuleType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::SingleEvent => serializer.serialize_i32(1),
            Self::MultiEvent => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for RuleType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<RuleType>::new(
            ".google.cloud.chronicle.v1.RuleType",
        ))
    }
}

/// RuleView indicates the scope of fields to populate when returning the Rule
/// resource.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RuleView {
    /// The default/unset value.
    /// The API will default to the BASIC view for ListRules/ListRuleRevisions.
    /// The API will default to the FULL view for GetRule.
    Unspecified,
    /// Include basic metadata about the rule, but not the full contents.
    /// Returned fields include: revision_id, revision_create_time, display_name,
    /// author, severity, type, allowed_run_frequency,
    /// near_real_time_live_rule_eligible, etag, and scope.
    /// This is the default value for ListRules and ListRuleRevisions.
    Basic,
    /// Include all fields.
    /// This is the default value for GetRule.
    Full,
    /// Include basic metadata about the rule's revision only.
    /// Returned fields include: revision_id and revision_create_time.
    RevisionMetadataOnly,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [RuleView::value] or
    /// [RuleView::name].
    UnknownValue(rule_view::UnknownValue),
}

#[doc(hidden)]
pub mod rule_view {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl RuleView {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Basic => std::option::Option::Some(1),
            Self::Full => std::option::Option::Some(2),
            Self::RevisionMetadataOnly => std::option::Option::Some(3),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("RULE_VIEW_UNSPECIFIED"),
            Self::Basic => std::option::Option::Some("BASIC"),
            Self::Full => std::option::Option::Some("FULL"),
            Self::RevisionMetadataOnly => std::option::Option::Some("REVISION_METADATA_ONLY"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for RuleView {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for RuleView {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for RuleView {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Basic,
            2 => Self::Full,
            3 => Self::RevisionMetadataOnly,
            _ => Self::UnknownValue(rule_view::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for RuleView {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "RULE_VIEW_UNSPECIFIED" => Self::Unspecified,
            "BASIC" => Self::Basic,
            "FULL" => Self::Full,
            "REVISION_METADATA_ONLY" => Self::RevisionMetadataOnly,
            _ => Self::UnknownValue(rule_view::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for RuleView {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Basic => serializer.serialize_i32(1),
            Self::Full => serializer.serialize_i32(2),
            Self::RevisionMetadataOnly => serializer.serialize_i32(3),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for RuleView {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<RuleView>::new(
            ".google.cloud.chronicle.v1.RuleView",
        ))
    }
}
